/**
 * 
 */
package com.bolbachchan.common.ui;

import java.io.Serializable;
import java.util.Arrays;

/**
 * @author Chaitanya
 * 
 */
public class DefaultDashboard implements Dashboard, Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = -8474477775724732482L;

    private Column[] columns;
    private Object[] rows;

    /**
     * 
     */
    public DefaultDashboard() {

    }

    /**
     * @param columns
     * @param rows
     */
    public DefaultDashboard(Column[] columns, Object[] rows) {
	this.columns = columns;
	this.rows = rows;
    }

    /*
     * (non-Javadoc)
     * @see com.bolbachchan.common.ui.Dashboard#getColumns()
     */
    @Override
    public Column[] getColumns() {
	return columns;
    }

    public void setColumns(Column[] columns) {
	this.columns = columns;
    }

    /*
     * (non-Javadoc)
     * @see com.bolbachchan.common.ui.Dashboard#getRows()
     */
    @Override
    public Object[] getRows() {
	return rows;
    }

    public void setRows(Object[] rows) {
	this.rows = rows;
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
	StringBuilder builder = new StringBuilder();
	builder.append("DefaultDashboard [columns=");
	builder.append(Arrays.toString(columns));
	builder.append(", rows=");
	builder.append(Arrays.toString(rows));
	builder.append("]");
	return builder.toString();
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
	final int prime = 31;
	int result = 1;
	result = prime * result + Arrays.hashCode(columns);
	result = prime * result + Arrays.hashCode(rows);
	return result;
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
	if (this == obj)
	    return true;
	if (obj == null)
	    return false;
	if (getClass() != obj.getClass())
	    return false;
	DefaultDashboard other = (DefaultDashboard) obj;
	if (!Arrays.equals(columns, other.columns))
	    return false;
	if (!Arrays.equals(rows, other.rows))
	    return false;
	return true;
    }
}
